/**
 * SIX VULN - http://code.google.com/p/six-vuln/
 * Copyright (C) 2006
 *   National Institute of Advanced Industrial Science and Technology (AIST)
 *   Registration Number: H20PRO-863
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jp.go.aist.six.vuln.model.scap.vulnerability;

import java.io.Serializable;



/**
 *
 * @author	Akihito Nakamura, AIST
 * @version $Id: AssociatedExploitLocationType.java 529 2013-04-15 07:08:54Z nakamura5akihito@gmail.com $
 */
public class AssociatedExploitLocationType
    implements Serializable
{

    public static final Boolean DEFAULT_PHYSICAL_ACCESS = Boolean.FALSE;
    public static final Boolean DEFAULT_VULNERAVILITY_INTERACT = Boolean.FALSE;
    public static final Boolean DEFAULT_DIALUP = Boolean.FALSE;
    public static final Boolean DEFAULT_UNKNOWN = Boolean.FALSE;

    //{0..1, default="false"}
    private Boolean  physicalAccess;
    private Boolean  vulneravilityInteract;
    private Boolean  dialup;
    private Boolean  unknown;



    /**
     *
     */
    public AssociatedExploitLocationType()
    {
    }



    /**
     */
    public void setPhysicalAccess(
                    final Boolean physicalAccess
                    )
    {
        this.physicalAccess = physicalAccess;
    }


    public Boolean isPhysicalAccess()
    {
        return physicalAccess;
    }


    public static boolean physicalAccess(
                    final AssociatedExploitLocationType associatedExploitLocation
                    )
    {
        if (associatedExploitLocation == null) {
            throw new IllegalArgumentException( "null associatedExploitLocation" );
        }

        final Boolean  physicalAccess = associatedExploitLocation.isPhysicalAccess();
        return (physicalAccess == null ? DEFAULT_PHYSICAL_ACCESS : physicalAccess);
    }



    /**
     */
    public void setVulneravilityInteract(
                    final Boolean vulneravilityInteract
                    )
    {
        this.vulneravilityInteract = vulneravilityInteract;
    }


    public Boolean isVulneravilityInteract()
    {
        return vulneravilityInteract;
    }


    public static boolean vulneravilityInteract(
                    final AssociatedExploitLocationType associatedExploitLocation
                    )
    {
        if (associatedExploitLocation == null) {
            throw new IllegalArgumentException( "null associatedExploitLocation" );
        }

        final Boolean  vulneravilityInteract = associatedExploitLocation.isVulneravilityInteract();
        return (vulneravilityInteract == null ? DEFAULT_VULNERAVILITY_INTERACT : vulneravilityInteract);
    }



    /**
     */
    public void setDialup(
                    final Boolean dialup
                    )
    {
        this.dialup = dialup;
    }


    public Boolean isDialup()
    {
        return dialup;
    }


    public boolean dialup(
                    final AssociatedExploitLocationType associatedExploitLocation
                    )
    {
        if (associatedExploitLocation == null) {
            throw new IllegalArgumentException( "null associatedExploitLocation" );
        }

        final Boolean  dialup = associatedExploitLocation.isDialup();
        return (dialup == null ? DEFAULT_DIALUP : dialup);
    }



    /**
     */
    public void setUnknown(
                    final Boolean unknown
                    )
    {
        this.unknown = unknown;
    }


    public Boolean isUnknown()
    {
        return unknown;
    }


    public boolean unknown(
                    final AssociatedExploitLocationType associatedExploitLocation
                    )
    {
        if (associatedExploitLocation == null) {
            throw new IllegalArgumentException( "null associatedExploitLocation" );
        }

        final Boolean  unknown = associatedExploitLocation.isUnknown();
        return (unknown == null ? DEFAULT_UNKNOWN : unknown);
    }



    //**************************************************************
    //  java.lang.Object
    //**************************************************************

    @Override
    public int hashCode()
    {
        final int  prime = 37;
        int  result = 17;

        result = prime * result + (physicalAccess( this ) ? 0 : 1);
        result = prime * result + (vulneravilityInteract( this )  ? 0 : 1);
        result = prime * result + (dialup( this )  ? 0 : 1);
        result = prime * result + (unknown( this )  ? 0 : 1);

        return result;
    }



    @Override
    public boolean equals(
                    final Object obj
                    )
    {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof AssociatedExploitLocationType)) {
            return false;
        }

        if (super.equals( obj )) {
            AssociatedExploitLocationType  other = AssociatedExploitLocationType.class.cast( obj );
            if (physicalAccess( this ) == physicalAccess( other )
                            && vulneravilityInteract( this ) == vulneravilityInteract( other )
                            && dialup( this ) == dialup( other )
                            && unknown( this ) == unknown( other )
                            ) {
                return true;
            }
        }

        return false;
    }



    @Override
    public String toString()
    {
        return "[physicalAccess="               + isPhysicalAccess()
                + ", vulneravilityInteract="    + isVulneravilityInteract()
                + ", dialup="                   + isDialup()
                + ", unknown="                  + isUnknown()
                + "]";
    }

}
//AssociatedExploitLocationType
